﻿using Abp.Domain.Entities.Auditing;
using Akso.Infrastructure.Data.Annotations;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Akso.Entities
{
    /// <summary>
    /// 收支账单，带审计和软删除。
    /// </summary>
    [Table("Finance_Bills")] //对应数据库的表名，建议规则：模块名+实体名。
    public class Bill: FullAuditedEntity<Guid>
    {
        public const int MaxNameLength = 50;
        public const int MaxIncomeExpendTypeLength = 50;
        public const int MaxBillAccountLength = 50;
        public const int MaxRemarkLength = 200;
        public const int MaxCheckProjectLength = 50;
        public const int MaxCheckCustomerLength = 50;
        public const int MaxCheckUserLength = 50;

        /// <summary>
        /// 收支所属校区
        /// </summary>
        [Required]//字段必填   
        [MaxLength(MaxNameLength)]
        public virtual string SchoolName { get; set; }
        public virtual Guid SchoolId { get; set; }
        /// <summary>
        /// 收支日期
        /// </summary>
        public virtual DateTime BillDate { get; set; }
        /// <summary>
        /// 账单类型 1:收入 2:支出 3:转账 4:往来 5:调整
        /// </summary>
        public virtual int BillTypeId { get; set; }
        /// <summary>
        /// 收支类型
        /// </summary>
        [MaxLength(MaxIncomeExpendTypeLength)]
        public virtual string IncomeExpendType { get; set; }
        public virtual Guid IncomeExpendTypeId { get; set; }
        /// <summary>
        /// 收支账户
        /// </summary>
        [MaxLength(MaxBillAccountLength)]
        public virtual string BillAccount { get; set; }
        public virtual Guid BillAccountId { get; set; }
        /// <summary>
        /// 收入金额
        /// </summary>
        [DecimalPrecision(10, 2)]
        public virtual decimal IncomeAmount { get; set; }
        /// <summary>
        /// 支出金额
        /// </summary>
        [DecimalPrecision(10, 2)]
        public virtual decimal ExpendAmount { get; set; }
        /// <summary>
        /// 收支备注
        /// </summary>
        [MaxLength(MaxRemarkLength)]
        public virtual string Remark { get; set; }
        /// <summary>
        /// 核算项目
        /// </summary>
        [MaxLength(MaxCheckProjectLength)]
        public virtual string CheckProject { get; set; }
        public virtual Guid? CheckProjectId { get; set; }
        /// <summary>
        /// 核算客户
        /// </summary>
        [MaxLength(MaxCheckCustomerLength)]
        public virtual string CheckCustomer { get; set; }
        public virtual Guid? CheckCustomerId { get; set; }
        /// <summary>
        /// 核算用户
        /// </summary>
        [MaxLength(MaxCheckUserLength)]
        public virtual string CheckUser { get; set; }
        public virtual Guid? CheckUserId { get; set; }
    }
}
